if (NOT DEFINED DATA_DIR)
	set (DATA_DIR "" CACHE STRING "Common data directory" FORCE)
endif()
if (NOT "${DATA_DIR}" STREQUAL "")
	if ("${BERKELEY_DIR}" STREQUAL "")
		add_definitions( -DBERKELEY_DIR=${DATA_DIR}/BSDS500 )
	endif()
	if ("${VOC_DIR}" STREQUAL "")
		add_definitions( -DVOC_DIR=${DATA_DIR} )
	endif()
	if ("${COCO_DIR}" STREQUAL "")
		add_definitions( -DCOCO_DIR=${DATA_DIR}/COCO )
	endif()
	add_definitions( -DWEIZMANN_DIR=${DATA_DIR}/weizmann_horse_db )
endif()

find_package( Matio )
if( NOT MATIO_FOUND )
	add_definitions( -DIGNORE_BERKELEY=1 )
endif()

if (NOT DEFINED BERKELEY_DIR)
	set (BERKELEY_DIR "" CACHE STRING "Use BERKELEY_DIR as the data directory" FORCE)
endif()
if (NOT "${BERKELEY_DIR}" STREQUAL "")
	add_definitions( -DBERKELEY_DIR=${BERKELEY_DIR} )
endif()
if (NOT DEFINED VOC_DIR)
	set (VOC_DIR "" CACHE STRING "Use VOC_DIR as the data directory" FORCE)
endif()
if (NOT "${VOC_DIR}" STREQUAL "")
	add_definitions( -DVOC_DIR=${VOC_DIR} )
endif()
if (NOT DEFINED COCO_DIR)
	set (COCO_DIR "" CACHE STRING "Use COCO_DIR as the data directory" FORCE)
endif()
if (NOT "${COCO_DIR}" STREQUAL "")
	add_definitions( -DCOCO_DIR=${COCO_DIR} )
endif()
if (NOT DEFINED NYU_DIR)
	set (NYU_DIR "" CACHE STRING "Use NYU_DIR as the data directory" FORCE)
endif()
if (NOT "${NYU_DIR}" STREQUAL "")
	add_definitions( -DNYU_DIR=${NYU_DIR} )
endif()

include_directories( ${MATIO_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} )

add_library( dataset nyu.cpp voc.cpp apng.cpp berkeley.cpp evaluation.cpp covering.cpp weizmann.cpp coco.cpp )
target_link_libraries( dataset imgproc ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} boost_numpy ${ZLIB_LIBRARIES} ${MATIO_LIBRARIES} )
